package com.yulongtian.oneProblemEveryDay.month202211.day20220824;

/**
 * @author YulongTian
 * @date 2022/8/24 - 8:50
 */
public class Test01 {
    public static void main(String[] args) {

    }


    public static boolean canBeEqual(int[] target, int[] arr) {
        int targetLen = target.length;
        int arrLen = arr.length;
        if (targetLen != arrLen) {
            return false;
        }

        int[] tempArr1 = new int[arrLen + 1];
        int[] tempArr2 = new int[arrLen + 1];

        for (int i = 0; i < arrLen; i++) {
            tempArr1[target[i]]++;
            tempArr2[arr[i]]++;
        }
        for (int i = 0; i < arrLen + 1; i++) {
            if (tempArr1[i] != tempArr2[i]) {
                return false;
            }
        }
        return true;


    }
}
